package com.yan.thread;

/**
 * @author taoge
 * @Date 2024/8/7 15:50
 * @Description 优先级  PRIORITY
 */
public class ThreadDemo5 {
    public static void main(String[] args) {
        Thread t1 = new Thread(new MyTask5(), "线程A");
        t1.setPriority(Thread.MAX_PRIORITY);
        t1.start();

        Thread t2 = new Thread(new MyTask5(), "----线程B");
        t2.setPriority(Thread.MIN_PRIORITY);
        t2.start();
    }
}

class MyTask5 implements Runnable{

    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println(Thread.currentThread().getName() + "---" + i);
        }
    }
}
